// 目的地详情
define([
	'backbone',
	'./components/swiper',
	'./components/header.scroll',
	'./components/ui.tab',
	'./components/nav.scroll'
], function(Backbone, SwiperView, HeaderScrollView, UITab, NavScroll) {

	var CountryIdxView = Backbone.View.extend({
		el: '#app',
		initialize: function() {
			this.renderEls();
			// 轮播广告
			this.initAdSwiper();
			// 横向滚动组件
			this.initXSwiper();
			// 头部渐变
			this.initHeaderScroll();
			// tab组件
			this.initUITab();
			// 头部导航滚动组建
			this.initNavScroll();
		},
		renderEls: function() {
			this.els = {
				// 可以横向滚动的dom
				xSwiper: this.$('.com-scrollx-wrap')
			}
		},
		initAdSwiper: function() {
			this.AdSwiper = new SwiperView({
				el: '.country-ad-swiper',
				pagination: '.swiper-pagination',
				autoplay: 3000,
				autoplayDisableOnInteraction: false
			});
		},
		initXSwiper: function() {
			this.VideoSwiper = new SwiperView({
				el: this.els.xSwiper,
				slidesPerView: 'auto'
			});
		},
		initHeaderScroll: function() {
			this.HeaderScroll = new HeaderScrollView({
				banner: '.country-ad-swiper'
			});
		},
		initUITab: function() {
			this.enjoyUITab = new UITab({
				el: this.$("#j_enjoy_card")
			});
			this.trafficUITab = new UITab({
				el: this.$('#j_traffic_card')
			});
		},
		initNavScroll: function() {
			this.NavScroll = new NavScroll();
		}
	});

	new CountryIdxView();
});